package com.huaju.enity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Account entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "account", catalog = "licai")
@JsonIgnoreProperties(value={"bankcards","profits","payoutlists","notices","wageses","incomelists"})
public class Account implements java.io.Serializable {

	// Fields

	private Integer aid;
	private Position position;
	private Integer comId;
	private String name;
	private String phoneModel;
	private Date birth;
	private Integer sex;
	private String img;
	private Date createtime;
	private Date lastloginTime;
	private String tel;
	private String pwd;
	private String openId;
	private Short isjob;
	private String etr;
	private String identityCard;
	private String wages;
	private Double balance;
	private Double profit;
	private Double principal;
	private Set<Bankcard> bankcards = new HashSet<Bankcard>(0);
	private Set<Profit> profits = new HashSet<Profit>(0);
	private Set<Payoutlist> payoutlists = new HashSet<Payoutlist>(0);
	private Set<Notice> notices = new HashSet<Notice>(0);
	private Set<Wages> wageses = new HashSet<Wages>(0);
	private Set<Incomelist> incomelists = new HashSet<Incomelist>(0);

	// Constructors

	/** default constructor */
	public Account() {
	}

	/** full constructor */
	public Account(Position position, String name, String phoneModel,
			Date birth, Integer sex, String img, Date createtime,
			Date lastloginTime, String tel, String pwd, String openId,
			Short isjob, String etr, String identityCard, String wages,
			Set<Bankcard> bankcards, Set<Profit> profits,
			Set<Payoutlist> payoutlists, Set<Notice> notices,
			Set<Wages> wageses, Set<Incomelist> incomelists) {
		this.position = position;
		this.name = name;
		this.phoneModel = phoneModel;
		this.birth = birth;
		this.sex = sex;
		this.img = img;
		this.createtime = createtime;
		this.lastloginTime = lastloginTime;
		this.tel = tel;
		this.pwd = pwd;
		this.openId = openId;
		this.isjob = isjob;
		this.etr = etr;
		this.identityCard = identityCard;
		this.wages = wages;
		this.bankcards = bankcards;
		this.profits = profits;
		this.payoutlists = payoutlists;
		this.notices = notices;
		this.wageses = wageses;
		this.incomelists = incomelists;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "aid", unique = true, nullable = false)
	public Integer getAid() {
		return this.aid;
	}

	public void setAid(Integer aid) {
		this.aid = aid;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "positionid")
	public Position getPosition() {
		return this.position;
	}

	public void setPosition(Position position) {
		this.position = position;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "phoneModel")
	public String getPhoneModel() {
		return this.phoneModel;
	}

	public void setPhoneModel(String phoneModel) {
		this.phoneModel = phoneModel;
	}

	@Column(name = "birth", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd" ) 
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone = "GMT+8")
	public Date getBirth() {
		return this.birth;
	}

	public void setBirth(Date birth) {
		this.birth = birth;
	}

	@Column(name = "sex")
	public Integer getSex() {
		return this.sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	@Column(name = "img", length = 65535)
	public String getImg() {
		return this.img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	@Column(name = "createtime", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss" ) 
    @JsonFormat(pattern="yyyy-MM-dd  hh:mm:ss" ,timezone = "GMT+8")
	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "lastloginTime", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss" ) 
    @JsonFormat(pattern="yyyy-MM-dd  hh:mm:ss" ,timezone = "GMT+8")
	public Date getLastloginTime() {
		return this.lastloginTime;
	}

	public void setLastloginTime(Date lastloginTime) {
		this.lastloginTime = lastloginTime;
	}

	@Column(name = "tel")
	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "pwd")
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "openId")
	public String getOpenId() {
		return this.openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	@Column(name = "isjob")
	public Short getIsjob() {
		return this.isjob;
	}

	public void setIsjob(Short isjob) {
		this.isjob = isjob;
	}

	@Column(name = "etr", length = 65535)
	public String getEtr() {
		return this.etr;
	}

	public void setEtr(String etr) {
		this.etr = etr;
	}

	@Column(name = "identityCard")
	public String getIdentityCard() {
		return this.identityCard;
	}

	public void setIdentityCard(String identityCard) {
		this.identityCard = identityCard;
	}

	@Column(name = "wages")
	public String getWages() {
		return this.wages;
	}

	public void setWages(String wages) {
		this.wages = wages;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "account")
	public Set<Bankcard> getBankcards() {
		return this.bankcards;
	}

	public void setBankcards(Set<Bankcard> bankcards) {
		this.bankcards = bankcards;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "account")
	public Set<Profit> getProfits() {
		return this.profits;
	}

	public void setProfits(Set<Profit> profits) {
		this.profits = profits;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "account")
	public Set<Payoutlist> getPayoutlists() {
		return this.payoutlists;
	}

	public void setPayoutlists(Set<Payoutlist> payoutlists) {
		this.payoutlists = payoutlists;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "account")
	public Set<Notice> getNotices() {
		return this.notices;
	}

	public void setNotices(Set<Notice> notices) {
		this.notices = notices;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "account")
	public Set<Wages> getWageses() {
		return this.wageses;
	}

	public void setWageses(Set<Wages> wageses) {
		this.wageses = wageses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "account")
	public Set<Incomelist> getIncomelists() {
		return this.incomelists;
	}

	public void setIncomelists(Set<Incomelist> incomelists) {
		this.incomelists = incomelists;
	}

	public Integer getComId() {
		return comId;
	}

	public void setComId(Integer comId) {
		this.comId = comId;
	}

	public Double getProfit() {
		return profit;
	}

	public void setProfit(Double profit) {
		this.profit = profit;
	}

	public Double getPrincipal() {
		return principal;
	}

	public void setPrincipal(Double principal) {
		this.principal = principal;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

}